package com.bgIntlgn.client.entity.manufacture.oem;

import java.util.Date;

import yuhuibear.poat.annotations.action.AutoGenerateValue;
import yuhuibear.poat.annotations.relation.Field;
import yuhuibear.poat.annotations.relation.Table;
import yuhuibear.poat.object.bean.Bean;

/**
 * oem 订单
 * 
 * @author yuhui
 * 
 */
@Table(name = "oem_orders", constrain = "")
public class OEMOrder implements Bean {

	@AutoGenerateValue(skipOnNull = true, sqlToGet = "select currval('oem_orders_id_seq')")
	@Field(name = "id", type = "bigserial", constrain = "primary key ")
	private Long id;

	@Field(name = "order_date", type = "date", constrain = "")
	private Date orderDate;

	@Field(name = "serial_number", type = "varchar(80)", constrain = "unique")
	private String serialNumber;

	@Field(name = "custom_id", type = "int8", constrain = " not null references customs(id)  on update cascade ")
	private Long customId;

	@Field(name = "contactor_id", type = "int8", constrain = " not null references contactors(id)  on update cascade ")
	private Long contactorId;

	/**
	 * 对应的生产计划。
	 */
	@Field(name = "plan_id", type = "int8 ", constrain = " not null references production_plans(id)  on update cascade on delete cascade")
	private Long planId;

	/**
	 * 订单总金额
	 */
	@Field(name = "sum", type = "float ", constrain = "not null default 0.0")
	private Double sum;

	@Field(name = "comment", type = "varchar(1000)", constrain = "")
	private String comment;

	public enum State {
		// 草稿, 生产中, 回款/历史,
		draft, producing, history;
	}

	/**
	 * oem订单状态: 见如上的枚举类.
	 */
	@Field(name = "states", type = "int", constrain = "not null ")
	private int states;

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getOrderDate() {
		return this.orderDate;
	}

	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}

	public String getSerialNumber() {
		return this.serialNumber;
	}

	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}

	public Long getCustomId() {
		return this.customId;
	}

	public void setCustomId(Long customId) {
		this.customId = customId;
	}

	public Long getContactorId() {
		return this.contactorId;
	}

	public void setContactorId(Long contactorId) {
		this.contactorId = contactorId;
	}

	public Long getPlanId() {
		return this.planId;
	}

	public void setPlanId(Long planId) {
		this.planId = planId;
	}

	public Double getSum() {
		return this.sum;
	}

	public void setSum(Double sum) {
		this.sum = sum;
	}

	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public int getStates() {
		return this.states;
	}

	public void setStates(int states) {
		this.states = states;
	}

}
